package vue;

import java.awt.event.ActionListener;
import java.awt.event.MouseListener;
import javax.swing.ImageIcon;
import javax.swing.JRadioButton;

/**
 *
 * @author gervaila
 */
public class BoutonModele extends javax.swing.JPanel {

	/**
	 * Creates new form bouttonModele
	 */
	public BoutonModele() {
		initComponents();
	}

	/**
	 * Défini le texte du bouton
	 *
	 * @param text le texte à mettre sur le boutton
	 */
	public void setTexteBoutton(String text) {
		jBoutton.setText(text);
	}

	/**
	 * Ajoute un action listner 'al' au boutton
	 *
	 * @param al l'action listener à ajouter
	 */
	public void addActionListenerBoutton(ActionListener al) {
		jBoutton.addActionListener(al);
	}

	/**
	 * Défini l'image présente à coté du boutton
	 *
	 * @param img l'image a afficher
	 */
	public void setImage(ImageIcon img) {
		labelImage.setIcon(img);
	}

	/**
	 * Ajoute un mouse listener au bouton
	 *
	 * @param ml le mouse listener à ajouter
	 */
	public void addMouseListenerImage(MouseListener ml) {
		labelImage.addMouseListener(ml);
	}

	/**
	 *
	 * @return le JBouton
	 */
	public JRadioButton getjBoutton() {
		return jBoutton;
	}

	/**
	 * This method is called from within the constructor to initialize the form.
	 * WARNING: Do NOT modify this code. The content of this method is always
	 * regenerated by the Form Editor.
	 */
	@SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        labelImage = new javax.swing.JLabel();
        jBoutton = new javax.swing.JRadioButton();

        setPreferredSize(new java.awt.Dimension(300, 50));

        labelImage.setText("jLabel1");
        labelImage.setMaximumSize(new java.awt.Dimension(50, 50));
        labelImage.setMinimumSize(new java.awt.Dimension(50, 50));
        labelImage.setPreferredSize(new java.awt.Dimension(50, 50));

        jBoutton.setText("jRadioButton1");

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addComponent(labelImage, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jBoutton, javax.swing.GroupLayout.DEFAULT_SIZE, 242, Short.MAX_VALUE))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                .addComponent(labelImage, javax.swing.GroupLayout.DEFAULT_SIZE, 50, Short.MAX_VALUE)
                .addComponent(jBoutton))
        );
    }// </editor-fold>//GEN-END:initComponents
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JRadioButton jBoutton;
    private javax.swing.JLabel labelImage;
    // End of variables declaration//GEN-END:variables
}
